package com.example.demo.command;

import ch.selise.exercise.pattern.notepad.command.CommandExecutor;
import ch.selise.exercise.pattern.notepad.command.GetCommandParameter;
import ch.selise.exercise.pattern.notepad.exception.EmptyStackException;
import ch.selise.exercise.pattern.notepad.exception.ExecuteException;
import ch.selise.exercise.pattern.notepad.exception.UnsupportedCommandException;

import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;

public class PrintActionCommand extends ActionCommand implements ClickListener {

	private static final long serialVersionUID = -1943927868793367325L;

	public PrintActionCommand(String command) {
		super(command);
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void postClickAction(ClickEvent event) {
		
		CommandExecutor commandExecutor = CommandExecutor.getInstance();
		try {
			commandExecutor.executeCommand(new GetCommandParameter(getCommand(), "test", 0));
		}  catch (ExecuteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (EmptyStackException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (UnsupportedCommandException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
